package com.dating.base.dto;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.dating.base.bean.Permission;

public class Menu {

	private String name ;
	
	private String url ;
	
	private String icon ;
	
	private String desc ;
	
	private String hilightKey ;
	
	private int level = 0; 
	
	private String need ;
	
	private List<Menu> subMenus = new ArrayList<Menu>();
	
	
	
	public Menu(){
		
	}
	
	public Menu(Permission permission){
		if(permission.isMenu()){
			this.name = permission.getName();
			this.url = permission.getUrl();
			this.icon = permission.getIcon();
			this.desc = permission.getDescription();
			this.hilightKey = permission.getHilightKey();
			this.level = permission.getLevel();
			this.need = permission.getNeedPermission();
		}
	}
	
	public void fullSubMenu(List<Menu> menus){
		for (Menu menu : menus) {
			if(this.name.equals(menu.getNeed())){
				menu.fullSubMenu(menus);
				this.subMenus.add(menu);
			}
		}
	}
	
	
	

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public String getHilightKey() {
		return hilightKey;
	}

	public void setHilightKey(String hilightKey) {
		this.hilightKey = hilightKey;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	
	
	public String getNeed() {
		return need;
	}

	public void setNeed(String need) {
		this.need = need;
	}

	public List<Menu> getSubMenus() {
		return subMenus;
	}

	public void setSubMenus(List<Menu> subMenus) {
		this.subMenus = subMenus;
	}
	
}
